<template>
    <!-- 添加 -->
    <view class="mine-box">
        <view class="input-box">
            <view>收货人：</view>
            <input type="text" value="" />
        </view>
        <view class="input-box">
            <view>手机号：</view>
            <input type="text" value="" />
        </view>
        <view class="input-box" @tap="openLevel">
            <view>所在区域：</view>
            <input type="text" value="" />
            <image class="home_icon_ged_nor" src="../../static/images/home_icon_ged_nor.png" mode=""></image>
        </view>
        <view class="input-box">
            <view>所在小区：</view>
            <input type="text" value="" />
        </view>
        <view class="input-box">
            <view>详细地址：</view>
            <input type="text" value="" />
        </view>
        <view class="input-box none">
            <view>设置为默认地址</view>
            <switch checked color="#5dd55d" style="transform:scale(0.6)"/>
        </view>
        <view class="btns" @click="add">
            添加地址
        </view>
        <level-linkage ref="levelLinkage"
        	:pickerValueDefault="pickerValueDefault" 
        	:allData="treeData"
        	@onConfirm="onConfirm" themeColor='#007AFF'></level-linkage>
    </view>
</template>

<script>
	import levelLinkage from "@/components/three-level-linkage/linkage.nvue"
export default {
    components: {
    	levelLinkage
    },
    data() {
    return {
        
            // 数组第一项 表示最左侧第一列表 元素index 必须大于等于0
            // 数组第二项 表示最左侧第二列表 元素index 当值小于 0 时，即变成一级选择器
            // 数组第三项 表示最左侧第三列表 元素index 当值小于 0 时，即变成二级选择器（如果第二项小于 0 则无论第三项是否大于0 都不显示）
            pickerValueDefault: [0, 0, 0],
            pickerText: '',
            treeData: [
                {
                    "id":"1",
                    "name":"北京",
                    "code":"11",
                    "children":[
                        {
                            "id":"1230040276324601858",
                            "name":"北京大学",
                            "code":"10001",
                            "children":[
                                {
                                    "id":"1219144373145477122",
                                    "name":"风景园林",
                                    "code":"fengjingyuanlin"
                                },
                                {
                                    "id":"1219144593367408641",
                                    "name":"广播电视",
                                    "code":"guangbodianshi"
                                },
                                {
                                    "id":"1219144901711667202",
                                    "name":"建筑学",
                                    "code":"jianzhuxue"
                                },
                                {
                                    "id":"1227895002827407361",
                                    "name":"停招",
                                    "code":"tingzhao"
                                }
                            ]
                        },
                        {
                            "id":"1230040276500762626",
                            "name":"清华大学",
                            "code":"10003",
                            "children":[
                                {
                                    "id":"1227895285913567233",
                                    "name":"城乡规划（城市规划）",
                                    "code":"chengxiangguihua"
                                },
                                {
                                    "id":"1219144272230522882",
                                    "name":"雕塑",
                                    "code":"diaosu"
                                },
                                {
                                    "id":"1219144319747792898",
                                    "name":"动漫",
                                    "code":"dongman"
                                },
                                {
                                    "id":"1219144373145477122",
                                    "name":"风景园林",
                                    "code":"fengjingyuanlin"
                                },
                                {
                                    "id":"1219144412131532802",
                                    "name":"服装设计",
                                    "code":"fuzhuangsheji"
                                },
                                {
                                    "id":"1219144454728884225",
                                    "name":"工业设计",
                                    "code":"gongyesheji"
                                },
                                {
                                    "id":"1219144498089598978",
                                    "name":"工艺美术",
                                    "code":"gongyimeishu"
                                },
                                {
                                    "id":"1219144628058497025",
                                    "name":"国画",
                                    "code":"guohua"
                                },
                                {
                                    "id":"1219144667669504001",
                                    "name":"环境设计",
                                    "code":"huanjingsheji"
                                },
                                {
                                    "id":"1219144708824014849",
                                    "name":"环境艺术",
                                    "code":"huanjingyishu"
                                },
                                {
                                    "id":"1219144789576949761",
                                    "name":"绘画",
                                    "code":"huihua"
                                },
                                {
                                    "id":"1219144866961858562",
                                    "name":"建筑史",
                                    "code":"jianzhushi"
                                },
                                {
                                    "id":"1219144901711667202",
                                    "name":"建筑学",
                                    "code":"jianzhuxue"
                                },
                                {
                                    "id":"1219145078623215618",
                                    "name":"科普硕士",
                                    "code":"kepushuoshi"
                                },
                                {
                                    "id":"1219145224144592897",
                                    "name":"染织设计",
                                    "code":"ranzhisheji"
                                },
                                {
                                    "id":"1219145386988445697",
                                    "name":"摄影",
                                    "code":"sheying"
                                },
                                {
                                    "id":"1219145461957435394",
                                    "name":"视觉传达",
                                    "code":"shijuechuanda"
                                },
                                {
                                    "id":"1219145533864583169",
                                    "name":"书法",
                                    "code":"shufa"
                                },
                                {
                                    "id":"1219145569100931073",
                                    "name":"数字媒体",
                                    "code":"shuzimeiti"
                                },
                                {
                                    "id":"1227896860333654018",
                                    "name":"陶瓷陶艺",
                                    "code":"taocitaoyi"
                                },
                                {
                                    "id":"1219145760835149826",
                                    "name":"文物修复",
                                    "code":"wenwuxiufu"
                                },
                                {
                                    "id":"1219145971510845442",
                                    "name":"信息设计",
                                    "code":"xinxisheji"
                                },
                                {
                                    "id":"1219146010878582785",
                                    "name":"信息艺术设计",
                                    "code":"xinxiyishusheji"
                                },
                                {
                                    "id":"1219146055183015938",
                                    "name":"艺术管理",
                                    "code":"yishuguanli"
                                },
                                {
                                    "id":"1219146134597967873",
                                    "name":"艺术学理论",
                                    "code":"yishuxuelilun"
                                },
                                {
                                    "id":"1219146300742737922",
                                    "name":"造型设计",
                                    "code":"zaoxingsheji"
                                },
                                {
                                    "id":"1219146338717966338",
                                    "name":"展示设计",
                                    "code":"zhanshisheji"
                                }
                            ]
                        },
                        {
                            "id":"1230040276454625281",
                            "name":"北京航空航天大学",
                            "code":"10006",
                            "children":[
                                {
                                    "id":"1219144319747792898",
                                    "name":"动漫",
                                    "code":"dongman"
                                },
                                {
                                    "id":"1219144454728884225",
                                    "name":"工业设计",
                                    "code":"gongyesheji"
                                },
                                {
                                    "id":"1219144789576949761",
                                    "name":"绘画",
                                    "code":"huihua"
                                },
                                {
                                    "id":"1219145461957435394",
                                    "name":"视觉传达",
                                    "code":"shijuechuanda"
                                },
                                {
                                    "id":"1219145569100931073",
                                    "name":"数字媒体",
                                    "code":"shuzimeiti"
                                }
                            ]
                        },
                        {
                            "id":"1230040276454625282",
                            "name":"北京理工大学",
                            "code":"10007",
                            "children":[
                                {
                                    "id":"1227895075556638722",
                                    "name":"不区分",
                                    "code":"buqufen"
                                },
                                {
                                    "id":"1219144454728884225",
                                    "name":"工业设计",
                                    "code":"gongyesheji"
                                },
                                {
                                    "id":"1219144708824014849",
                                    "name":"环境艺术",
                                    "code":"huanjingyishu"
                                },
                                {
                                    "id":"1219145280591536130",
                                    "name":"设计史",
                                    "code":"shejishi"
                                },
                                {
                                    "id":"1219145461957435394",
                                    "name":"视觉传达",
                                    "code":"shijuechuanda"
                                },
                                {
                                    "id":"1219145424410025986",
                                    "name":"实验艺术",
                                    "code":"shiyanyishu"
                                },
                                {
                                    "id":"1219145569100931073",
                                    "name":"数字媒体",
                                    "code":"shuzimeiti"
                                },
                                {
                                    "id":"1227895002827407361",
                                    "name":"停招",
                                    "code":"tingzhao"
                                },
                                {
                                    "id":"1219146259248488450",
                                    "name":"油画",
                                    "code":"youhua"
                                }
                            ]
                        },
                        {
                            "id":"1230040276458819585",
                            "name":"北京师范大学",
                            "code":"10027",
                            "children":[
                                {
                                    "id":"1219144237023535106",
                                    "name":"电影",
                                    "code":"dianying"
                                },
                                {
                                    "id":"1219144272230522882",
                                    "name":"雕塑",
                                    "code":"diaosu"
                                },
                                {
                                    "id":"1219144593367408641",
                                    "name":"广播电视",
                                    "code":"guangbodianshi"
                                },
                                {
                                    "id":"1219144628058497025",
                                    "name":"国画",
                                    "code":"guohua"
                                },
                                {
                                    "id":"1219144789576949761",
                                    "name":"绘画",
                                    "code":"huihua"
                                },
                                {
                                    "id":"1219145797497561090",
                                    "name":"舞蹈",
                                    "code":"wudao"
                                },
                                {
                                    "id":"1219145843601350658",
                                    "name":"戏剧影视",
                                    "code":"xijuyingshi"
                                },
                                {
                                    "id":"1219146169012232194",
                                    "name":"音乐",
                                    "code":"yinyue"
                                },
                                {
                                    "id":"1227895184327524353",
                                    "name":"音乐舞蹈",
                                    "code":"yinyuewudao"
                                },
                                {
                                    "id":"1219146134597967873",
                                    "name":"艺术学理论",
                                    "code":"yishuxuelilun"
                                },
                                {
                                    "id":"1219146259248488450",
                                    "name":"油画",
                                    "code":"youhua"
                                }
                            ]
                        }
                    ]
                },
                {
                    "id":"2",
                    "name":"天津",
                    "code":"12",
                    "children":[
                        {
                            "id":"1230040276496568322",
                            "name":"南开大学",
                            "code":"10055",
                            "children":[
                                {
                                    "id":"1219144412131532802",
                                    "name":"服装设计",
                                    "code":"fuzhuangsheji"
                                },
                                {
                                    "id":"1219144547225870338",
                                    "name":"公共艺术",
                                    "code":"gonggongyishu"
                                }
                            ]
                        },
                        {
                            "id":"1230040276509151235",
                            "name":"天津大学",
                            "code":"10056",
                            "children":[
                                {
                                    "id":"1227895075556638722",
                                    "name":"不区分",
                                    "code":"buqufen"
                                },
                                {
                                    "id":"1227895285913567233",
                                    "name":"城乡规划（城市规划）",
                                    "code":"chengxiangguihua"
                                }
                            ]
                        }
                    ]
                },
            ]
        
    }
    },
    watch:{},
    onLoad() {
        
    },
    methods: {
        openLevel() {
        	this.$refs.levelLinkage.open();
        },
        onConfirm(e) {
        	// e 确认后选中的数据
        	this.pickerText = JSON.stringify(e)
        },
        add(){
            uni.redirectTo({
                url: './address'
            })
        }
    }
}
</script>

<style scoped lang="less">
.mine-box{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    
}
.none{
    border-bottom: none!important;
}
.input-box{
    border-bottom: 1rpx solid #F5F5F5;
    height: 108rpx;
    padding: 0 26rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #333333;
    
    input{
        flex: 1;
    }
    .home_icon_ged_nor{
        width: 18rpx;
        height: 32rpx;
    }
}
.btns{
    width: 600rpx;
    height: 80rpx;
    border-radius: 20rpx;
    text-align: center;
    line-height: 80rpx;
    background: #f04545;
    color: #fff;
    position: absolute;
    bottom: 25rpx;
    left: 50%;
    transform: translateX(-50%);
    
    &:active{
        background: #ef2b2b;
    }
}
</style>
